import { createVNode, render } from 'vue'
import message from './xtx-message.vue'

const div = document.createElement('div')
document.body.appendChild(div)

let timer = null
export default ({ type, text }) => {
  const vnode = createVNode(message, { type, text })
  render(vnode, div)
  clearTimeout(timer)
  timer = setTimeout(() => {
    render(null, div)
  }, 3000)
}
